<?php

use App\Http\Controllers\ExpertController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VideoController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


//用户登录注销
Route::get('/adm/login',[UserController::class,'login'])->name('login');//同上
Route::post('/adm/login',[UserController::class,'doLogin']);
Route::get('/adm/logout',[UserController::class,'logout'])->middleware('auth');//同上
//后台管理路由
Route::get('adm',[ExpertController::class,'admin'])->middleware('auth');//同上
//Route::prefix('adm')->group(function (){
Route::prefix('adm')->middleware('auth')->group(function (){//同上

    Route::get('/user',[UserController::class,'index']);//后台用户列表页
    Route::get('/user/add-user',[UserController::class,'create']);//后台新增用户
    Route::post('user/add-user',[UserController::class,'store']);//新增用户处理逻辑
    Route::get('/user/edit-user/{id}',[UserController::class,'edit']);//后台更改
    Route::post('user/edit-user/{id}',[UserController::class,'update']);//后台更改密码处理逻辑
    Route::post('/user/del-user',[UserController::class,'destroy']);//后台用户列表页

    Route::get('/expert',[ExpertController::class,'index']);//后台专家列表页
    Route::get('/expert/add',[ExpertController::class,'add']);//后台新增专家
    Route::post('expert/add',[ExpertController::class,'store']);//新增处理逻辑
    Route::post('expert/add/upload',[ExpertController::class,'upload']);//新增处理逻辑
//    Route::post('/expert/add/upload',[ExpertController::class,'upload']);//后台上传图片处理
    Route::get('/expert/edit/{id}',[ExpertController::class,'edit']);//后台更改
    Route::post('expert/edit/{id}',[ExpertController::class,'update']);//后台更改密码处理逻辑
    Route::post('/expert/del-expert',[ExpertController::class,'destroy']);//后台用户列表页

    Route::get('/video',[VideoController::class,'index']);//后台视频列表页
    Route::get('/video/add-video',[VideoController::class,'add']);//后台新增视频
    Route::post('video/add-video',[VideoController::class,'store']);//新增视频处理逻辑
    Route::get('/video/edit-video/{id}',[VideoController::class,'edit']);//后台更改
    Route::post('video/edit-video/{id}',[VideoController::class,'update']);//后台更改密码处理逻辑
    Route::post('/video/del-video',[VideoController::class,'destroy']);//后台用户列表页

    Route::post('/middletable/{id}',[VideoController::class,'middletable']);
});
//前台路由
Route::get('/conf',[ExpertController::class,'conf']);
Route::get('/expert',[ExpertController::class,'expert']);
Route::get('/expert/info/{id}',[ExpertController::class,'show']);
Route::get('/review',[VideoController::class,'review']);
Route::get('/review/info/{id}',[VideoController::class,'show']);


///////////!!!!!!!!!!!!!!!尚不足：paginate总页数，多对多关联的factory，


Route::get('/',HomeController::class);
